

package com.hazelcast.internal.serialization;

import com.hazelcast.internal.nio.BufferObjectDataInput;
import com.hazelcast.internal.nio.BufferObjectDataOutput;

import java.nio.ByteOrder;

public interface InputOutputFactory {

    BufferObjectDataInput createInput(Data data, InternalSerializationService service, boolean isCompatibility);

    BufferObjectDataInput createInput(byte[] buffer, InternalSerializationService service, boolean isCompatibility);

    BufferObjectDataInput createInput(byte[] buffer, int offset, InternalSerializationService service, boolean isCompatibility);

    BufferObjectDataOutput createOutput(int size, InternalSerializationService service);

    /**
     * Creating new {@link BufferObjectDataOutput}. The size of the internal buffer is set to initialSize at construction.
     * When the buffer is too small to accept new bytes the buffer will grow to at least firstGrowthSize.
     */
    BufferObjectDataOutput createOutput(int initialSize, int firstGrowthSize, InternalSerializationService service);

    ByteOrder getByteOrder();
}
